package bishi.jibite;

import java.util.*;

public class demo2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] a1 = new int[n + 1];// 技能1的参数
        int[] a2 = new int[n + 1];// 技能2的参数
        int[] a3 = new int[n + 1];// 技能3的参数

        for(int i = 1;i <= n;i++) {
            a1[i] = in.nextInt();
            a2[i] = in.nextInt();
            a3[i] = in.nextInt();
        }

        int[][] dp = new int[n + 1][2];

        //初始化
        dp[0][0] = 0;
        dp[0][1] = Integer.MIN_VALUE;

        for(int i = 1;i <= n;i++) {
            //统计对手前i回合的总票数
            int agoTotal = k*i;
            //当前回合用技能1
            if(dp[i - 1][0] != Integer.MIN_VALUE) {
                dp[i][1] = Math.max(dp[i][1],dp[i - 1][0] + a1[i] - agoTotal);
            }
            //用技能2
            dp[i][0] = Math.max(dp[i][0],dp[i - 1][0]+a2[i] - agoTotal);
            //用技能3
            dp[i][0] = Math.max(dp[i][0],dp[i - 1][0]+a3[i]-agoTotal);
            if(dp[i - 1][1]  != Integer.MIN_VALUE) {
                dp[i][1] = Math.max(dp[i][1],dp[i - 1][1] + a2[i] - agoTotal);
                dp[i][1] = Math.max(dp[i][1],dp[i - 1][1] + a3[i] - agoTotal);
            }
        }
        int MAX = Math.max(dp[n][0],dp[n][1]);

        if(MAX >= 0) {
            System.out.println("yes");
            System.out.println(MAX);
        }else{
            System.out.println("");
            System.out.println(MAX);
        }


    }
}
